<%@page import="com.wanmait.hotelManage.vo.Pager"%>
<%@page import="com.wanmait.hotelManage.vo.Room"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
    String path=request.getContextPath();
    List<Room>rooms=(List<Room>)request.getAttribute("rooms");
    %>
<table class="result-tab" width="100%">
                        <tr>
                            <th class="tc" width="5%"><input class="allChoose" name="" type="checkbox"></th>
                            <th>序号</th>
                            <th>客房号</th>
                            <th>标题</th>
                            <th>价格</th>
                            <th>折扣价格</th>
                            <th>状态</th>
                            <th>入住人员信息详情</th>
                            <th>操作</th>
                        </tr>
                        
                        <%
                        if(rooms!=null){
                        	for(int i=0;i<rooms.size();i++){
                        		Room room=rooms.get(i);
                        	
                        	%>
                        	<tr id="tr<%=room.getId()%>">
                            <td class="tc"><input data-id="<%=room.getId() %>" class="choose" name="id[]" value="59" type="checkbox"></td>
                            <td><%=i+1 %></td>
                            <td><%=room.getNumber() %></td>
                            <td><%=room.getRoomtype().getTitle() %></td>
                            <td><%=room.getRoomtype().getPrice() %></td>
                            <td><%=room.getRoomtype().getDiscountPrice() %></td>
                            <td class="check"><span class="checkin"><%=room.getCheckIn() %></span></td>
                           <td style="width:150px;"><a href="<%=path%>/manage/RoomServlet?action=checkinInformation&id=<%=room.getId()%>">显示信息</a></td>
                            <td>
                                <a class="link-update" href="<%=path%>/manage/RoomServlet?action=beforeupdate&id=<%=room.getId()%>">修改</a>
                                <a id="de<%=room.getId() %>" class="link-del" href="javascript:void(0)">删除</a>
                            </td>
                        </tr>
                        	<%
                        }
                        }
                        %>
                    </table>
                   <%-- <div class="qwe">
                    <%
                    Pager pager=(Pager)request.getAttribute("pager");
                    if(pager!=null){
                    	 int start= 1;
                         int end =pager.getPageCount();
                         if(pager.getPageCount()>5){
                        	 start=pager.getPageNo()-2<1?1:pager.getPageNo()-2;
                        	 end=start+4;
                        	 if(end>pager.getPageCount()){
                        		 end=pager.getPageCount();
                        		 start=end-4;
                        	 }
                         }
                         %>
                         [<a class="ok" href="javascript:void(0)">上一页</a>]
                         <%
                    	for(int i=start;i<=end;i++){
                    		if(pager.getPageNo()!=i){
                    		%>
                    		[<a class="number" href="javascript:void(0)"><%=i %></a>]
                    		<%
                    	}else{
                    		%>
                    		[<a class="aaa" href="javascript:void(0)"><%=i %></a>]
                    		<%
                    	}
                    }
                         %>
                         [<a class="no" href="javascript:void(0)">下一页</a>]
                         <%
                    }
                    %>
                    </div> --%>
                    <script>
                    $(function(){
                    	$(".checkin").each(function(){
                    		var check=$(this).html();
                    		
                    		if(check=="false"){
                    			$(this).html("空闲");
                    		}else if(check=="true"){
                    			$(this).html("入住");
                    		} 
                    	})
                    })
                    </script>
                   <%--  <script>
					$(".aaa").css("color","red");
					</script>
					<style>
					.qwe{
						text-align:center;
						}
						.aaa{
						text-align:center;
						}
					</style>
					 <script>
                    $(function(){
                    	$(".no").click(function(){
							/* $(".number").css("color","black");
							$(this).css("color","red"); */
							var content=<%=pager.getPageNo()%>;
							if(content<<%=pager.getPageCount()%>){
								content++;
							}
							$.ajax({
                    			url:"<%=path%>/manage/RoomServlet?action=search",
                    				data:{pageNo:content},
                    					success:function(msg){
                    						$("#pagediv").html(msg);
                    					}
                    		})
						})
						$(".ok").click(function(){
							/* $(".number").css("color","black");
							$(this).css("color","red"); */
							var content=<%=pager.getPageNo()%>;
							if(content>1){
								content--;
							}
							$.ajax({
                    			url:"<%=path%>/manage/RoomServlet?action=search",
                    				data:{pageNo:content},
                    					success:function(msg){
                    						$("#pagediv").html(msg);
                    					}
                    		})
						})
                    	$(".number").click(function(){
                   		var content=$(this).html();
                   		alert(content)
                   		$.ajax({
                   			url:"<%=path%>/manage/RoomServlet?action=search",
                   			data:{pageNo:content},
                   			success:function(msg){
                   				$("#pagediv").html(msg);
                   			}
                   		})
                   		
                   	})
                   	
                    })
                    </script>  --%>